package com.ptszyxx.popose;

import android.os.Environment;
import androidx.multidex.MultiDex;
import com.ptszyxx.popose.common.utils.YChatUtil;
import com.ptszyxx.popose.common.utils.YInitSdkUtil;
import com.ysg.base.BaseApplication;
import com.ysg.utils.YDbUtils;
import java.io.File;

public class MyApp extends BaseApplication {
    private static MyApp instance;
    public static MyApp instance() {
        return instance;
    }

    public String mVoicesDir01;
    public String mAppDir;

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        //分包
        MultiDex.install(this);
        //腾讯云IM登录状态监听
        YChatUtil.getInstance().initLoginStatusListener();
        //创建文件目录
        initFile();
        //初始化数据库
        YDbUtils.getInstance().init();
        //统一初始化
        YInitSdkUtil.init(false);
    }

    private void initFile() {
        File file = getExternalFilesDir(null);
        if (file == null) {
            return;
        }
        if (file != null) {
            mAppDir = file.getAbsolutePath();
        }
        file = getExternalFilesDir(Environment.DIRECTORY_MUSIC);
        if (!file.exists()) {
            file.mkdirs();
        }
        mVoicesDir01 = file.getAbsolutePath();

//        FileConstant.apk_dir = this.getExternalFilesDir(null).getPath()+"/apk/";
    }
}
